<template>
	<view class="list">
		<view class="wrap" v-for="(item,index) in list" :key="index" @tap="click(item.goods_id)">
			<view class="img-box">
				<image :src="item.goods_image" mode="widthFix" class="img"></image>
			</view>
			<view class="font">
				<view class="h3 line2">
					{{item.goods_name}}
				</view>
				<view class="price flex">
					<view class="money" v-if="type">
						<text>{{parseInt(item.goods_price)}}积分</text>
					</view>
					<view class="money" v-else>
						¥ <text>{{item.goods_price}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import { mapState, mapMutations, mapGetters } from 'vuex';
	export default {
		//属性
		props: {
			list:{
				type: Array,
				default () {
					return [];
				}
			},
			type:{
				type:String,
				default:'',
			}
		},
		methods: {
			click(id){
				this.$emit('onClick',id);
			},
		}
	}
	
</script>

<style lang="scss" scoped>
	.list{
		// column-count: 2;
		// column-gap: 18rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		.wrap{
			page-break-inside: avoid; 
			background: $white;
			box-shadow: 0px 2rpx 6rpx 8rpx rgba(0, 0, 0, 0.02);
			margin-bottom: 20rpx;
			width: 48.5%;
			&:nth-of-type(2n){
				margin-right: 0rpx;
			}
			.img-box{
				height: 300rpx;
				overflow: hidden;
			}
			.img{
				width: 100%;
			}
			.font{
				padding: 12rpx 16rpx 30rpx;
				border-bottom-left-radius: 16rpx;
				border-bottom-right-radius: 16rpx;
				.h3{
					font-size: $font-b;
					color: $black;
					line-height: 40rpx;
					margin-top: 20rpx;
					min-height: 60rpx;
				}
				.money{
					color: $red;
					margin: 5rpx 0;
					margin-right: 16rpx;
					font-size: 20rpx;
					text{
						font-size: 32rpx;
					}
				}
				.delet{
					font-size: $font-s;
					line-height: 130%;
					text-decoration-line: line-through;
					color: $gray;
				}
				.sell{
					font-size: $font-s;
					line-height: 160%;
					color: $gray;
				}
			}
			
		}
	}
</style>